//package com.source.code;
//
//
//import static com.source.codemap.file.LoopFileReadCodeUtil.getClassNameFromFilePath;
//
//import com.source.code.analyzer.ClassInfoAnalyzer;
//import com.source.code.converter.ClassInfoToJsonConverter;
//import com.source.code.model.MethodInfo;
//import com.source.code.model.MethodInfoStatic;
//
//import java.util.ArrayList;
//import java.util.List;
//import java.util.Map;
//import java.util.Optional;
//
///**
// * 类信息到 JSON 应用程序
// *
// * @author wangchangjie
// * @date 2024/02/01
// */
//public class ClassInfoToJsonApp {
//
//
//    public static Map<String, MethodInfoStatic> methodInfoMap;
//
//    public static Map<String, List<MethodInfoStatic>> classInfoMap;
//
//    public static void main(String[] args) {
////        long start = System.currentTimeMillis();
////        String folderPath = System.getProperty("user.dir");
////        List<String> javaFilePaths = getJavaFilePaths(folderPath);
////        List<MethodInfoStatic> list = new ArrayList<>();
////        // TODO:多线程
////        for (String filePath : javaFilePaths) {
////            LogUtil.printf("Processing file: " + filePath);
////            List<MethodInfoStatic> methodInfos = doService(filePath);
////            list.addAll(methodInfos);
////        }
////        LogUtil.printf("==========================代码分析提取结束==========================");
////        long elapsedTime = System.currentTimeMillis() - start;
////        LogUtil.printf("总耗时：" + elapsedTime + "ms");
////
////        // 使用类调用
////        ChildMethodExtractor childMethodExtractor = new ChildMethodSelfExtractor();
////        MethodInnerExtractor methodInnerExtractor = new ClassMethodInnerExtractor(childMethodExtractor);
////        classInfoMap = list.stream().collect(Collectors.groupingBy(MethodInfoStatic::getClassAllName, Collectors.toList()));
////        // 补全子方法信息
////        methodInfoMap = list.stream().collect(Collectors.toMap(MethodInfoStatic::getMethodAbsName, v -> v));
////        list.forEach(m -> {
////            // 1.只要类
////            if (!TopClassTypeEnum.CLASS.getCode().equals(m.getTopClassType())){
////                // 结束当前迭代
////                return;
////            }
////            // 2.解析方法内部代码
////            List<MethodChildInfo> childMethodAllNames = methodInnerExtractor.getChildMethodAllNames(
////                m.getMethod(), m.getClassDeclaration(), m.getCompilationUnit());
////            m.setChildMethodAllNames(childMethodAllNames);
////        });
////        LogUtil.printf(getJsonString(BeanUtil.copyToList(list, MethodInfo.class)));
//    }
//
//    public static String getJsonString(List<MethodInfo> list) {
//        return ClassInfoToJsonConverter.convertToJson(list);
//    }
//
//    private static List<MethodInfoStatic> doService(String filePath) {
//        ClassInfoAnalyzer analyzer = new ClassInfoAnalyzer();
//        return getJsonResult(analyzer, filePath);
//    }
//
//    private static List<MethodInfoStatic> getJsonResult(ClassInfoAnalyzer analyzer, String filePath) {
//        Optional<List<MethodInfoStatic>> analyze = analyzer.analyze(filePath, getClassNameFromFilePath(filePath));
//        return analyze.orElseGet(ArrayList::new);
//    }
//}